package com.yhsoft.benefitcard.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yhsoft.benefitcard.controller.request.AddCardsBatch1InVo;
import com.yhsoft.benefitcard.entity.CardsBatch1;
import com.yhsoft.benefitcard.mapper.CardsBatch1Mapper;
import com.yhsoft.benefitcard.service.ICardsBatch1Service;
import com.yhsoft.common.service.TokenService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 福利卡一级批次信息表 服务实现类
 * </p>
 *
 * @author yyyyyyyh
 * @since 2023-10-04
 */
@Service
public class CardsBatch1ServiceImpl extends ServiceImpl<CardsBatch1Mapper, CardsBatch1> implements ICardsBatch1Service {

    @Override
    public void addBatch1(AddCardsBatch1InVo inVo,String batchNum) {
        CardsBatch1 batch1 = new CardsBatch1();
        batch1.setCardType(inVo.getCardType());
        batch1.setTotalNum(inVo.getCardSize());
        batch1.setFirstBatchNum(batchNum);
        batch1.setDistributorId(TokenService.getUserBytoken().getCompanyId());
        // 1-正常，0-冻结
        batch1.setIsEnable(1);
        baseMapper.insert(batch1);
    }
}
